package com.zhoug.demo.common.designpattern.clone;

/**
 * @author: zhoug
 * @since: 2025-07-08
 */
public class Firm  implements DataCloneable<Firm> {
    private String name;//企业名称
    private double longitude;//经度
    private double latitude;//纬度
    private Address address;//企业地址

    @Override
    public Firm copy() {
        Firm clone=new Firm();
        clone.name=name;
        clone.longitude=longitude;
        clone.latitude=latitude;
        //浅拷贝 共享地址实例
//        clone.address=address;
        //深拷贝 创建新的地址实例
        clone.address=address.copy();
        return clone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }



}
